#ifndef _CMD_HANDLER_H_
#define _CMD_HANDLER_H_

#include "main.h"
#define SYS_SCORE	70


#define BOOT_MODE_AP            (0x50)
#define BOOT_MODE_IAP           (0xF5)

#define HT_SRAM_BASE        ((uint32_t)0x20000000)
#define wb(addr, value)     (*((uint8_t  volatile *) (addr)) = value)
#define rb(addr)            (*((uint8_t  volatile *) (addr)))
#define whw(addr, value)    (*((uint16_t volatile *) (addr)) = value)
#define rhw(addr)           (*((uint16_t volatile *) (addr)))
#define ww(addr, value)     (*((uint32_t volatile *) (addr)) = value)
#define rw(addr)            (*((uint32_t volatile *) (addr)))
	

#define BIT_15              0x8000
#define BIT_14              0x4000
#define BIT_13              0x2000
#define BIT_12              0x1000
#define BIT_11              0x0800
#define BIT_10              0x0400
#define BIT_09              0x0200
#define BIT_08              0x0100
#define BIT_07              0x0080
#define BIT_06              0x0040
#define BIT_05              0x0020
#define BIT_04              0x0010
#define BIT_03              0x0008
#define BIT_02              0x0004
#define BIT_01              0x0002
#define BIT_00              0x0001
#define BIT_OVER            0x0000

typedef enum
{
	STATE_PRO_FLAG = 0,
	STATE_INDEX_MAX
}SysStateTypedef;

void FSC_DataHandler(uint8_t Data);
void FSC_CmdHandler(void);

void FSC_SetState(uint8_t n, int8_t state);
int8_t FSC_GetState(uint8_t n);

uint16_t FSC_AllInit(void);
uint32_t _IAP_Reset(uint32_t uMode);
#endif
